#include "main.h"

#include "RTE_Components.h"

#include "Driver_USART.h"

extern   ARM_DRIVER_USART         Driver_USART1;
#define  ptrUSART1               (&Driver_USART1)

extern   ARM_DRIVER_USART         Driver_USART2;
#define  ptrUSART2               (&Driver_USART2)

extern   ARM_DRIVER_USART         Driver_USART3;
#define  ptrUSART3               (&Driver_USART3)

// ARM_USART_SignalEvent_t
void ARM_USART1_SignalEvent(uint32_t   event)
{
    switch (event)
    {
    case ARM_USART_EVENT_RECEIVE_COMPLETE:
        break;
    case ARM_USART_EVENT_SEND_COMPLETE :
        break;
    case ARM_USART_EVENT_TX_COMPLETE :

    default:
        break;
    }
}



//------------------------------------------------------------------------------
//  CAN Interface Initialization
//------------------------------------------------------------------------------
bool USART1_Initialize(void)
{
    ARM_USART_CAPABILITIES     usarat_cap;
    ptrUSART1->Initialize(ARM_USART1_SignalEvent);
    ptrUSART1->PowerControl(ARM_POWER_FULL);
    ptrUSART1->Control(ARM_USART_MODE_ASYNCHRONOUS, 115200);
#ifdef NEVER
    ptrUSART1->Control(ARM_USART_DATA_BITS_8);
    ptrUSART1->Control(ARM_USART_PARITY_NONE);
    ptrUSART1->Control(ARM_USART_STOP_BITS_1);
    ptrUSART1->Control(ARM_USART_FLOW_CONTROL_NONE);
    ptrUSART1->Control(ARM_USART_CPOL0);
    ptrUSART1->Control(ARM_USART_CPHA0);
#endif /* NEVER */
    ptrUSART1->GetStatus();


#if 0
    ptrUSART1->SetModemControl();
#endif
    return true;
}




extern int stdout_putchar(int ch)
{
	ptrUSART1->Send(&ch,1);
    return ch;
}

